﻿@{
    Layout = "~/Views/Shared/_Layout_RTU_well.cshtml";
    ViewBag.Title = "全部数据";
}
<div class="xds-no-breadcrumb">
    <div class="full-height">
        <div class="full-height-scroll white-bg border-left">
            <div class="wrapper wrapper-content animated fadeInRight">
                <div class="row">
                    <div class="col-md-12">
                        <div class="panel panel-primary" id="list-panel">
                            <div class="panel-heading">
                                <h1 class="panel-title">全部数据</h1>
                            </div>
                            <div class="panel-body">
                                <table class="table table-striped table-bordered table-hover " id="editable">
                                    <thead>
                                        <tr>
                                            <th>时间</th>
                                            <th>标识位</th>
                                            <th>参数名</th>
                                            <th>参数值</th>
                                            <th>取值范围</th>
                                            <th>参数类型</th>
                                        </tr>
                                    </thead>
                                    <tbody></tbody>
                                    <tfoot>
                                        <tr>
                                            <th>时间</th>
                                            <th>标识位</th>
                                            <th>参数名</th>
                                            <th>参数值</th>
                                            <th>取值范围</th>
                                            <th>参数类型</th>
                                        </tr>
                                    </tfoot>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section Styles {
    @Styles.Render("~/Content/plugins/dataTables/dataTablesStyles")
}

@section Scripts {
    @Scripts.Render("~/plugins/dataTables")
    <script type="text/javascript">
        $(document).ready(function () {
            $('#editable').dataTable({
                "language": {
                    "processing": "处理中...",
                    "lengthMenu": "显示 _MENU_ 项结果",
                    "zeroRecords": "没有匹配结果",
                    "info": "显示第 _START_ 至 _END_ 项结果，共 _TOTAL_ 项",
                    "infoEmpty": "显示第 0 至 0 项结果，共 0 项",
                    "infoFiltered": "(由 _MAX_ 项结果过滤)",
                    "infoPostFix": "",
                    "search": "搜索:",
                    "searchPlaceholder": "搜索...",
                    "url": "",
                    "emptyTable": "表中数据为空",
                    "loadingRecords": "载入中...",
                    "infoThousands": ",",
                    "paginate": {
                        "first": "首页",
                        "previous": "上页",
                        "next": "下页",
                        "last": "末页"
                    },
                    "aria": {
                        paginate: {
                            first: '首页',
                            previous: '上页',
                            next: '下页',
                            last: '末页'
                        },
                        "sortAscending": ": 以升序排列此列",
                        "sortDescending": ": 以降序排列此列"
                    },
                    "decimal": "-",
                    "thousands": ","
                }
            })
            $.ajax({
                url: "/Data/Data",
                method: 'GET',
                data: { wellid: sessionStorage.wellid },
                dataType: 'json',
                success: function (data) {
                    if (data.status == 2) { alert("您没有权限") }
                    else if (data.status == 3) { alert("暂无数据") }
                    else {
                        $.each(data.data, function (i, item) {
                            fnClickAddRow(item.Datetime, item.Identifier, item.Parameter, item.Value, item.Range, item.Style);
                        })
                    }
                }
            });
        });
        function fnClickAddRow(Datetime, Identifier, Parameter, Value, Range, Style) {
            $('#editable').dataTable().fnAddData([
                Datetime,
                Identifier,
                Parameter,
                Value,
                Range,
                Style]);
        }
    </script>
}
